package hongcaosp.app.android.user.settings.wallet.dialog;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;

import hongcaosp.app.android.R;
import xlj.lib.android.base.utils.ScreenUtils;

/**
 * 支付方式
 */
public class DialogPayType extends Dialog {

    private Context context;
    private View.OnClickListener callback;

    public DialogPayType(@NonNull Context context,View.OnClickListener callback) {
        super(context,R.style.SelectDialog);
        this.context = context;
        this.callback = callback;
        init();
    }

    private void init() {
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_pay_type,null,false);

        view.findViewById(R.id.ll_wechat).setOnClickListener(callback);
        view.findViewById(R.id.ll_alipay).setOnClickListener(callback);
        view.findViewById(R.id.ll_cancel).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
            }
        });

        setContentView(view);

        WindowManager.LayoutParams wmlp = getWindow().getAttributes();
        wmlp.width = ScreenUtils.getScreenWidth(context);
        wmlp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        wmlp.gravity = Gravity.BOTTOM;

        getWindow().setAttributes(wmlp);
    }
}
